﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.Supervise.Model;
namespace HZ.Supervise.Web.Secondphase.ReportCompany
{
    public partial class CompanyGoodsDetail_sc : BasePage
    {
        private string strgoodsid = "";//流水号
        private string strMosth = "";//月份 
        private string strcompanynameps = "";//配送企业名称
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["query"] = URLUtil.GetSuperviseQueryFromURL(Request);
                BindList();
            }
        }
        void BindList()
        {
            SuperviseQuery query = ViewState["query"] as SuperviseQuery;
            strMosth = query.Mid;
            strgoodsid = query.ProcureCatalogID;
            strcompanynameps = query.CompanyName_SC;

            SuperviseQuery sq = new SuperviseQuery();
            int t = 0;
            IList<HZ.Supervise.Model.Supervise> CompanyList;
            HZ.Supervise.BLL.BLL_Statistics Bll_sta = (HZ.Supervise.BLL.BLL_Statistics)HZ.Supervise.BLLFactory.IBLL_Statistics();
            sq.CompanyName_SC = strcompanynameps;
            sq.ProcureCatalogID = strgoodsid;
            sq.Append = Function.FormatPlanTime("PlanTime", strMosth);

            sq.ProductName = HZ.Fun.CheckString(this.txtProductName.Text.Trim());
            sq.MedicineModelName = HZ.Fun.CheckString(this.txtMedicinemodel.Text.Trim());

            sq.Pack = HZ.Fun.CheckString(this.txtPack.Text.Trim());
            sq.Unit = HZ.Fun.CheckString(this.txtUnit.Text.Trim());

            sq.SortFields = this.droSortField.SelectedValue + " asc";

            CompanyList = Bll_sta.GetTradeInfo(sq, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out t);
            AspNetPager1.RecordCount = t;
            this.gvwDetail.DataSource = CompanyList;
            this.gvwDetail.DataBind();

        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            BindList();
        }
    }
}
